﻿/***************************************************************/
/* 讲师职位配置表。                                             */
/* 开发者：王继辉										       */
/* 时间：2014-02-27  									       */
/* 网址：                                                      */
/* 感谢：www.google.com,www.baidu.com…… all                  */
/* 联系：394594745@qq.com                                      */
/***************************************************************/


//新增
var fnCustomAdd = function () {
    window.parent.$("#tabs").tabs('close', '讲师职位配置-添加');
    var pagetitle = "讲师职位配置-添加";
    parent.addTabs(pagetitle, '/Crm/Sale/AddCrmUserPostionConfig.aspx?r=' + Math.random() + '&entity=CrmUserPostionConfig&title=' + encodeURI(pagetitle));
    parent.parent.NeedRefreshPage = this;
}


//修改
var fnCustomEdit = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    var record = myDataTable.getRecord(recordID);
    var vid = record.getData(const_entityID);
    if (vid == null || typeof (vid) == "undefined") { alert("请选择记录"); return; }
    window.parent.$("#tabs").tabs('close', '讲师职位配置-修改');
    var pagetitle = "讲师职位配置-修改";
    parent.addTabs(pagetitle, '/Crm/Sale/AddCrmUserPostionConfig.aspx?r=' + Math.random() + '&entity=CrmUserPostionConfig&id=' + vid + '&title=' + encodeURI(pagetitle));
    parent.parent.NeedRefreshPage = this;
}




//列表数据格式化 方法
var SN = [];
SN["Sign"] = new Array("", "EXLecturer", "EXAssistant", "InnerLecturer", "InnerManager");
SN["Name"] = new Array("其他", "推广讲师", "推广讲师助理", "内训讲师部讲师", "内训讲师部总经理");
 
//通用数据格式显示
var fn_FormatTypeName = function (elCell, oRecord, oColumn, sData) {
     //debugger 
    var Type = oRecord.getData("KeyCode");
    var temp = sData;
    var _num = IsExistArrayIndex(SN["Sign"], Type);
    if (_num < 0 || _num > SN["Sign"].length) _num = 0;
    temp = SN["Name"][_num];
    elCell.innerHTML = Type+"("+temp+")";
} 

//是否存在位置
var IsExistArrayIndex = function (ary, val) {
    var index = -1;
    if (ary == null || ary.length == 0) return 0;
    if (val == "" || ary.length == 0) return 0; 
    for (var i = 0; i < ary.length; i++) {
        if (ary[i] == val) {
            index = i;
            break;
        }
    }
    return index;
}

 